<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	template="/layout/template.xhtml">

	<ui:define name="body">

		<rich:panel>
			<f:facet name="header">#{messages.courseList}</f:facet>
			<rich:dataTable id="courseList" var="course"
				rendered="#{not empty peopleCourseHome.instructorResultList}"
				value="#{peopleCourseHome.instructorResultList}">
				<h:column>
					<f:facet name="header">#{messages.courseCode}</f:facet>
					<s:link id="courseCode" value="#{course.code}"
						view="/Course/course.xhtml">
						<f:param name="courseId" value="#{course.id}" />
					</s:link>
				</h:column>
				<h:column>
					<f:facet name="header">#{messages.courseName}</f:facet>
					<h:outputText value="#{course.name}" />
				</h:column>
				<h:column>
					<f:facet name="header">#{messages.courseSemester}</f:facet>
					<h:outputText value="#{course.semester.name}" />
				</h:column>
				<h:column>
					<f:facet name="header">#{messages.courseInstructor}</f:facet>
					<h:outputText value="#{course.instructor.nameToSrting()}" />
				</h:column>
				<h:column>
					<f:facet name="header">#{messages.courseTeachingAssistant}</f:facet>
					<h:outputText value="#{course.teachingAssistant.nameToSrting()}" />
				</h:column>
				<h:column>
					<f:facet name="header">#{messages.studentCount}</f:facet>
					<h:outputText value="#{course.students.size()}" />
				</h:column>
				<h:column>
					<f:facet name="header">#{messages.projectTeamCount}</f:facet>
					<h:outputText value="#{course.projectTeams.size()}" />
				</h:column>
				<h:column>
					<f:facet name="header">#{messages.action}</f:facet>
					<s:button id="editCourse" value="#{messages.editCourse}"
						propagation="begin" view="/Course/editCourse.xhtml" rendered="#{identity.hasRole('Instructor') or identity.hasRole('Teaching Assistant')}">
						<f:param name="courseId" value="#{course.id}" />
					</s:button>
					<s:button id="viewCourse" value="#{messages.viewCourse}" view="/Course/course.xhtml">
						<f:param name="courseId" value="#{course.id}" />
					</s:button>
				</h:column>
			</rich:dataTable>
			<div class="actionButtons">
				<s:button id="createCourse" value="#{messages.createCourse}"
					view="/Course/editCourse.xhtml"
					action="#{courseHome.clearInstance()}"/>
			</div>


		</rich:panel>

	</ui:define>
</ui:composition>
